<template>
	<view class="staffCustomer">
		<nav-bars bgColor="#fff" fontColor="#333" title="绑定客户"></nav-bars>
		<!-- <view class="topBg">
			<view class="search">
				<view class="searchBox">
					<text class="iconfont">&#xe68e;</text>
					<input type="text" @input="clearInput" confirm-type="search" @confirm="searchFn" value="" v-model="searchInput" placeholder="搜索客户" />
				</view>
			</view>
		</view> -->
		<view class="content">
			<view class="indexList">
				<view class="item" v-for="(item,index) in customerList" :key="index">
					<image :src="item.headimg" mode=""></image>
					<view class="info">
						<view class="name">
							<view class="omit-1" style="max-width: 280rpx;">
								{{item.nickname}}
							</view>
							<view class="tagBox">
								<!-- <text v-for="(item1,index1) in item.follow_data.tags" :key="index1">{{item1.tag_name}}</text> -->
								<!-- <text>重要</text> -->
							</view>
						</view>
						<view class="source">
							剩余时间：{{item.validity_day}}天{{item.validity_hour}}时{{item.validity_minute}}分
							<text>绑定时间：{{item.create_time}}</text>
						</view>
					</view>
				</view>
				<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
			</view>
		</view>
	</view>
</template>
<script>
	import { BindCustomerList } from '@/service/superHK.js';
export default {
	name: '',
	components: {},
	data() {
		return {
			status: 'loadmore',
			iconType: 'flower',
			loadText: {
				loadmore: '轻轻上拉',
				loading: '努力加载中',
				nomore: '实在没有了~'
			},
			baseImg:this.$static,
			navHeight:100,
			scrollTop:0,
			customerList:[],
			page:1,
			pagesize:10,
			moduleType:'',
		};
	},
	onLoad(options) {
		this.qyUserId = options.qyUserId
		this.type = options.type
		this.moduleType = options.moduleType
	},
	onShow() {
		this.getCustomer()
	},
	onReachBottom() {
		this.page++
		let params = {
			page:this.page,
			pageSize:this.pagesize
		}
		BindCustomerList(params).then(res=>{
			if(res.code==1){
				if(!res.data.list.length){
					this.status = 'nomore'
				}else{
					this.status = 'loading'
				}
				this.customerList = this.customerList.concat(res.data.list)
			}
		})
	},
	methods: {
		// 获取客户列表、
		getCustomer(){
			let params = {
				page:this.page,
				pageSize:this.pagesize
			}
			BindCustomerList(params).then(res=>{
				if(res.code == 1){
					if(res.data.list.length<10){
						this.status = 'nomore'
					}
					this.customerList = res.data.list?res.data.list:[]
				}else{
					this.status = 'nomore'
				}
			})
		},
		
		// 进入客户详情
		// toDetail(staffUserId,customUserId){
		// 	uni.navigateTo({
		// 		url:`/pages_client/pages/coustomDetail/index?staffUserId=${staffUserId}&customUserId=${customUserId}`
		// 	})
		// },
	}
};
</script>
<style lang="scss">
	.staffCustomer{
		position: relative;
		.topBg{
			width: 100%;
			height: 308rpx;
			background: url(https://manager.ryz1620.com/static/adminShop/client/bg.png) no-repeat;
			background-size: 100%;
			position: absolute;
			top: 0;
			left: 0;
			.search{
				margin-top: 197rpx;
				padding:  0 45rpx 0 32rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				image{
					width: 40rpx;
					height: 40rpx;
				}
				.searchBox{
					padding:  0 29rpx;
					display: flex;
					align-items: center;
					width: 690rpx;
					height: 80rpx;
					background-color: #f1f1f1;
					border-radius: 40rpx;
					.iconfont{
						color: #878787;
					}
					input{
						width: 100%;
						margin-left: 19rpx;
						font: 500 24rpx/80rpx PingFang SC;
						color: #878787;
					}
				}
			}
		}
		.content{
			padding:0 0 40rpx;
			.selectBox{
				display: flex;
				padding-left: 32rpx;
				.item{
					display: flex;
					align-items: center;
					padding: 20rpx 30rpx;
					background-color: #fff;
					margin-right: 20rpx;
					border-radius: 8rpx;
					.iconfont{
						font-size: 20rpx;
						margin-left: 10rpx;
					}
					.closeIcon{
						font-size: 36rpx;
					}
				}
			}
			.indexList{
				padding: 0rpx 32rpx 40rpx;
				.item{
					display: flex;
					align-items: center;
					image{
						width: 95rpx;
						height: 95rpx;
						border-radius: 40%;
						flex-shrink: 0;
						margin-right: 32rpx;
					}
					.info{
						width: 100%;
						display: flex;
						justify-content: space-between;
						align-items: center;
						padding: 30rpx 0;
						border-bottom: 2rpx solid #F1F1F1;
						.name{
							font: bold 32rpx/32rpx PingFang SC;
							color: #333;
							.tagBox{
								display: flex;
								align-items: center;
								margin-top: 15rpx;
								text{
									padding: 5rpx 10rpx;
									border-radius: 2rpx;
									background-color: #F4EBDC;
									font: 500 22rpx/22rpx PingFang SC;
									color: #AE8C6C;
									margin-right: 10rpx;
								}
							}
						}
						.source{
							display: flex;
							flex-direction: column;
							font: 500 22rpx/40rpx PingFang SC;
							color: #999;
							text{
								text-align: right;
							}
						}
					}
					.active{
						padding: 52rpx 0;
					}
				}
				.u-load-more-wrap{
					padding: 20rpx 0;
				}
			}
		}
	}
</style>
